<script setup lang="ts">
const emit = defineEmits(['clear'])
const props = defineProps({
    //返回上一页
    url: {
        type: String,
        default: '',
    },
    type: {
        type: Number,
        default: 0,
    },
})

//返回上一页
const handleback = () => {
    emit('clear')
    //清理缓存
    if (props.type === 1) {
        console.log(props.url)
        uni.navigateTo({
            url: `${props.url}`,
        })
        return
    } else if (props.type === 2) {
        uni.switchTab({
            url: `${props.url}`,
        })
        return
    } else if (props.type === 3) {
        uni.switchTab({
            url: `/pages/platform/index`,
        })
        return
    }
    // uni.switchTab({
    //     url: '/pages/platform/index',
    // })
    uni.navigateBack({
        delta: 1,
    })
}
</script>

<template>
    <view class="back" @click="handleback">
        <u-icon name="arrow-left" size="48" customPrefix="uicon"></u-icon>
    </view>
</template>

<style lang="scss" scoped>
@include b(back) {
    width: 90rpx;
    height: 90rpx;
    border-radius: 20rpx;
    background-color: rgba(255, 255, 255, 1);
    margin-left: 16rpx;
    display: flex;
    justify-content: center;
    align-items: center;
}
</style>
